Communication device and non-transitory computer-readable recording medium storing computer readable instructions for communication device

ABSTRACT

A communication device may output information according to a first scheme in a case where a first instruction is obtained in a first state, shift to a second state in a case where the first instruction is obtained in the first state, and shift to a third state in a case where a second instruction is obtained in the second state. In the first state, an authentication request according to the first scheme is not responded to and a search signal according to a second scheme is not responded to. In the second state, the authentication request using only a target channel can responded to and the search signal is not responded to. In the third state, the authentication request using only the target channel can be responded and the search signal using only the target channel can be responded to.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority to Japanese Patent Application No.2019-125432, filed on Jul. 4, 2019, the entire contents of which areincorporated herein by reference.

TECHNICAL FIELD

The description herein discloses an art for establishing a wirelessconnection between a communication device and another device.

BACKGROUND

A Device Provisioning Protocol scheme (hereinafter termed “DPP scheme”),which is a wireless communication scheme established by Wi-Fi Alliance,is known. The DPP scheme is a scheme for easily establishing a wirelessconnection according to Wi-Fi (Registered Trademark, Wi-Fi Alliance)standard between a pair of devices.

For example, a system provided with a smartphone, a camera, a printer,and an access point is known. The printer is connected to a wirelessnetwork formed by the access point as a station. When the printer is todisplay a QR Code (Registered Trademark, Denso Wave IncorporatedCorporation) according to the DPP scheme in this state, the printerdisplays a QR Code representing a value identical to a frequency channelused in the aforementioned wireless network. Then, the printer shifts toa standby state for receiving an authentication request from acommunication counterpart device in this frequency channel. When thesmartphone captures an image of the QR Code, the smartphone sends anauthentication request using the aforementioned frequency channel. Thus,the printer can receive this authentication request, after which theprinter receives communication parameters from the smartphone and newlyestablishes a wireless network. Further, the camera also displays the QRCode and shifts to a standby state for receiving an authenticationrequest, and receives the communication parameters from the smartphone.Then, the camera connects to the wireless network, to which the printeris also connected.

SUMMARY

In the aforementioned technique, in a situation in which the printershifts to the standby state for receiving an authentication requestaccording to the DPP scheme while the printer is in the state of beingconnected to a certain wireless network, the printer uses the channelidentical to the frequency channel used in the certain wireless network.The description herein provides an art that uses a method different fromthe aforementioned technique and allows a communication device to shiftto a standby state for receiving a signal in a suitable channel.

A communication device disclosed herein may comprise: a wirelessinterface configured to execute wireless communication according toWi-Fi standard; an output unit; and a controller configured to: executea process for establishing a wireless connection between thecommunication device and another device via the wireless interfaceaccording to a first scheme of the Wi-Fi standard; and execute a processfor establishing a wireless connection between the communication deviceand another device via the wireless interface according to a secondscheme of the Wi-Fi standard, the second scheme being different from thefirst scheme, wherein in a case where a first instruction for enablingcommunication according to the first scheme is obtained while a state ofthe communication device is a first state, the process for establishingthe wireless connection according to the first scheme includes:executing an output control process for causing the output unit toexternally output output-information according to the first scheme, theoutput-information being information obtained by using channelinformation indicating a target channel and a public key of thecommunication device, the target channel being one of a plurality ofchannels which the wireless interface is capable of using; and shiftingthe state of the communication device from the first state to a secondstate, the first state being a state in which the communication devicedoes not respond to an authentication request according to the firstscheme and does not respond to a search signal according to the secondscheme, the second state being a state in which the communication deviceis capable of responding to the authentication request using only thetarget channel among the plurality of channels and does not respond tothe search signal, wherein in a case where a second instruction forenabling a communication according to the second scheme is obtainedwhile the state of the communication device is the second state, theprocess for establishing the wireless connection according to the secondscheme includes: shifting the state of the communication device from thesecond state to a third state, the third state being a state in whichthe communication device is capable of responding to the authenticationrequest using only the target channel among the plurality of channelsand is capable of responding to the search signal using only the targetchannel among the plurality of channels.

Another communication device disclosed herein may comprise: a wirelessinterface configured to execute wireless communication according toWi-Fi standard; an output unit; and a controller configured to: executea process for establishing a wireless connection between thecommunication device and another device via the wireless interfaceaccording to a first scheme of the Wi-Fi standard; and execute a processfor establishing a wireless connection between the communication deviceand another device via the wireless interface according to a secondscheme of the Wi-Fi standard, the second scheme being different from thefirst scheme, wherein in a case where a second instruction for enablingcommunication according to the second scheme is obtained while a stateof the communication device is a first state, the process forestablishing the wireless connection according to the second schemeincludes: shifting the state of the communication device from the firststate to a second state, the first state being a state in which thecommunication device does not respond to an authentication requestaccording to the first scheme and does not respond to a search signalaccording to the second scheme, the second state being a state in whichthe communication device does not respond to the authentication requestand is capable of responding to the search signal using only a firstchannel, the first channel being one of a plurality of channels whichthe wireless interface is capable of using, wherein in a case where afirst instruction for enabling a communication according to the firstscheme is obtained while the state of the communication device is thesecond state, the process for establishing the wireless connectionaccording to the first scheme includes: executing an output controlprocess for causing the output unit to externally outputoutput-information according to the first scheme, the output-informationbeing information obtained by using channel information indicating asecond channel different from the first channel among the plurality ofchannels and a public key of the communication device; and shifting thestate of the communication device from the second state to a thirdstate, the third state being a state in which the communication deviceis capable of responding to the authentication request using only thesecond channel among the plurality of channels and is capable ofresponding to the search signal using only the second channel among theplurality of channels.

A control method and a computer program for realizing the aforementionedcommunication device, as well as a computer-readable recording mediumstoring the computer program are also novel and useful. Further, acommunication system provided with the aforementioned communicationdevice and another device is also novel and useful.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 shows a configuration of a communication system;

FIG. 2 shows a schematic sequence diagram of a process for establishinga Wi-Fi connection according to a DPP scheme between a printer and anaccess point;

FIG. 3 shows a sequence diagram of a Bootstrapping process;

FIG. 4 shows a sequence diagram of an Authentication process;

FIG. 5 shows a sequence diagram of a Configuration process;

FIG. 6 shows a sequence diagram of a Network Access process;

FIG. 7 shows a sequence diagram of a process for establishing a Wi-Ficonnection according to a WFD scheme between the printer and a secondterminal;

FIG. 8 shows a flowchart of a state shilling process of the printer;

FIG. 9 shows a sequence diagram of Case A in which the printer shifts toa WFD respondent state in a situation of having been in a DPP respondentstate;

FIG. 10 shows a sequence diagram of Case B in which the printer shiftsto the WFD respondent state in a situation of having been in a DPPnon-respondent state;

FIG. 11 shows a flowchart of a state shifting process of a secondembodiment;

FIG. 12 shows a sequence diagram of Case C in which the printer shiftsto the DPP respondent state in a situation of having been in the WFDrespondent state being a device state;

FIG. 13 shows a sequence diagram of Case D in which the printer shiftsto the DPP respondent state in a situation of having been in the WFDrespondent state being a Group Owner state and a WFD connection withanother device being established; and

FIG. 14 shows a sequence diagram of Case E in which the printer shiftsto the DPP respondent state in a situation of having been in the WFDrespondent state being the Group Owner state and a WFD connection withanother device being not established.

DETAILED DESCRIPTION First Embodiment

(Configuration of Communication System 2; FIG. 1)

As shown in FIG. 1, a communication system 2 is provided with an AccessPoint (hereinafter “AP”) 10, a first terminal 100, a second terminal200, and a printer 300. In the present embodiment, a situation isassumed in which a user uses the first terminal 100 to establish awireless connection according to a Wi-Fi standard (hereinafter termed“Wi-Fi connection”) between the printer 300 and the AP 10, and establisha Wi-Fi connection between the second terminal 200 and the printer 300.

(Configuration of First Terminal 100)

The first terminal 100 is a mobile terminal device such as a cellphone(such as a smartphone), a PDA, or a tablet PC. In a variant, the firstterminal 100 may be a stationary terminal device. The first terminal 100is provided with a Wi-Fi interface 106 and a camera 110. Hereinafter, aninterface will be abbreviated to “I/F”.

The Wi-Fi I/F 106 is a wireless interface configured to execute Wi-Ficommunication according to the Wi-Fi standard. The Wi-Fi standard is awireless communication standard for executing wireless communicationaccording to 802.11 standard of the Institute of Electrical andElectronics Engineers, Inc. (IEEE) and standards complying thereto (suchas 802.11a, 11b, 11g, 11n, 11ac, etc.), for example. The Wi-Fi I/F 16supports a Device Provisioning Protocol (DPP) scheme that is establishedby the Wi-Fi Alliance. The DPP scheme is described in the standard“Device Provisioning Protocol Technical Specification Version 1.0”created by the Wi-Fi Alliance, and is a connection scheme for easilyestablishing a Wi-Fi connection between a pair of devices (e.g. theprinter 300 and the AP 10) by using the first terminal 100. Hereinafter,the established Wi-Fi connection according to the DPP scheme may betermed “DPP connection”.

The camera 110 is a device for capturing an image of an object, and inthe present embodiment, it is used to capture a QR Code for the AP 10and the printer 300.

(Configuration of Second Terminal 200)

The second terminal 200 is also a mobile terminal device similar to thefirst terminal 100. In a variant, the second terminal 200 may be astationary device. The second terminal 200 is provided with a Wi-Fiinterface 206.

The Wi-Fi I/F 206 supports Wi-Fi DIRECT (WFD) (Registered Trademark,Wi-Fi Alliance) scheme established by the Wi-Fi Alliance. The WFD schemeis a connection scheme described in the standard “Wi-Fi Peer-to-Peer(P2P) Technical Specification Version1.1” created by the Wi-Fi Alliance.In the WFD, Group Owner state (hereinafter termed “G/O state”) andClient state (hereinafter termed “CL state”) are defined. Further, astate which is different from both the G/O state and the CL state istermed “device state” herein. The device which supports the WFD schemeis capable of selectively operating in one of the above three states.Hereinafter, the Wi-Fi connection established according to the WFDscheme may be termed “WFD connection”.

(Configuration of Printer 300)

The printer 300 is a peripheral device (e.g., a peripheral deviceworking with the first terminal 100 and the second terminal 200) that iscapable of executing a print function. The printer 300 is provided withan operation unit 302, a display unit 304, a Wi-Fi I/F 306, a printexecuting unit 308, and a controller 320. The respective units 302 to320 are connected to a bus line (for which a reference sign is notgiven).

The operation unit 302 includes a plurality of buttons. The operationunit 302 enables the user to input various instructions to the printer300 through the operation unit 302. The display unit 304 is a displayconfigured to display various types of information. The display unit 304may also include a touchscreen function (i.e. operation unit).Hereinafter, the operation unit 302 and the display unit 304 with thetouchscreen function may be collectively termed “the operation unit 302,304”. The print executing unit 308 includes a printing engine such as aninkjet technology or a laser technology.

The Wi-Fi I/F 306 supports both the DPP scheme and the WFD scheme. Dueto this, the printer 300 is capable of establishing the DPP connectionwith the AP 10 and further establishing the WFD connection with thesecond terminal 200.

The controller 320 includes a CPU 322 and a memory 324. The CPU 322 isconfigured to execute various processes according to a program 326stored in the memory 324. The memory 324 may be a volatile memory, anonvolatile memory, and/or the like.

(Overview of the DPP; FIG. 2)

Next, an overview of the DPP will be described with reference to FIG. 2.The AP 10 also supports the DPP scheme. In the present embodiment, theDPP connection between the printer 300 and the AP 10 is established byeach of the devices 10, 100, 300 executing communication according tothe DPP scheme. Hereinafter, to facilitate understanding, operationswhich CPUs (such as the CPU 322) of the respective devices will bedescribed with the devices (such as the printer 300) as subjects ofaction instead of describing the operations with the CPUs as thesubjects of action.

In T5, the first terminal 100 executes Bootstrapping (hereinafterabbreviated to “BS”) according to the DPP scheme with the AP 10. The BSis a process of providing information that is to be used inAuthentication (hereinafter abbreviated to “Auth”) of T10 (to bedescribed later) from the AP 10 to the first terminal 100 in response toa QR Code adhered to the AP 10 being captured by the camera 110 of thefirst terminal 100.

In T10, the first terminal 100 executes Auth according to the DPP schemewith the AP 10 by using the information obtained in the BS of T5. ThisAuth is a process for the first terminal 100 and the AP 10 toauthenticate their communication counterparts.

In T15, the first terminal 100 executes Configuration (hereinafterabbreviated to “Config”) according to the DPP scheme with the AP 10.This Config is a process of sending information for the AP 10establishing the DPP connection to the AP 10. Specifically, the firstterminal 100 generates a Configuration Object (hereinafter,Configuration Object is abbreviated to “CO”) for AP (hereinafter“AP-CO”), and sends the AP-CO to the AP 10. As a result, the AP-CO isstored in the AP 10.

Next, the first terminal 100 executes BS according to the DPP schemewith the printer 300 in T25. This BS is a process of providinginformation that is to be used in Auth of T30 (to be described later)from the printer 300 to the first terminal 100 in response to a QR Codedisplayed in the printer 300 being captured by the camera 110 of thefirst terminal 100.

In T30, the first terminal 100 executes Auth according to the DPP schemewith the printer 300 by using the information obtained in the BS of T25.This Auth is a process for the first terminal 100 and the printer 300 toauthenticate each other.

In T35, the first terminal 100 executes Config according to the DPPscheme with the printer 300. This Config is a process of sendinginformation to the printer 300 for establishing the DPP connectionbetween the printer 300 and the AP 10. In this Config, the firstterminal 100 generates a CO for printer (hereinafter “printer-CO”) forestablishing the DPP connection between the printer 300 and the AP 10,and sends the printer-CO to the printer 300. As a result, the printer-COis stored in the printer 300.

In T40, the printer 300 and the AP 10 execute the Network Access(hereinafter abbreviated to “NA”) according to the DPP scheme by usingthe stored AP-CO and printer-CO. The NA is a process for the printer 300and the AP 10 to share a connection key for establishing the DPPconnection. Then, the printer 300 and the AP 10 execute 4way-handshakecommunication. In at least a part of the 4way-handshake communication,the printer 300 and the AP 10 communicate encrypted informationencrypted by the shared connection key. Further, in a case wheredecryption of the encrypted information is successful, the DPPconnection is established between the printer 300 and the AP 10. Thus,the printer 300 can participate, as a child station, in a wirelessnetwork formed by the AP 10. In a variant, the printer 300 and the AP 10may execute Simultaneous Authentication of Equals (SAE, also called“Dragonfly”) communication, instead of the 4way-handshake communication.

In the DPP scheme, the user does not need to input information of thewireless network in which the AP 10 operates as a parent station (suchas a Service Set Identifier (SSID) and a password) to the printer 300 inorder to establish the DPP connection between the printer 300 and the AP10. As such, the user can easily establish the Wi-Fi connection betweenthe printer 300 and the AP 10.

(Description on Respective Processes; FIGS. 3 to 6)

Next, details of the respective processes executed in T25 to T40 of FIG.2 will be described with reference to FIGS. 3 to 6. Since the processesof T5 to T15 are similar to the processes of T25 to T35 except that theAP 10 is used instead of the printer 300, the detailed descriptionthereof will be omitted.

(Bootstrapping (BS); FIG. 3)

Firstly, the process of the BS executed in T25 of FIG. 2 will bedescribed with reference to FIG. 3. In an initial state of FIG. 3, thememory 324 of the printer 300 stores a public key PPK1 and a private keypsk1 of the printer 300 in advance.

In T100, the printer 300 causes the display unit 304 to display a QRCode. This QR Code is obtained by coding the public key PPK1 of theprinter 300, channel information of the printer 300, and the MAC address“macpr” of the Wi-Fi I/F 306 of the printer 300. The channel informationis information for indicating one channel (hereinafter termed “DPPchannel”) among a plurality of channels (that is, a frequency bandwidth)which the Wi-Fi I/F 306 is capable of using. In the present embodiment,the above plurality of channels is thirteen channels of 1ch to 13 ch.

In T110, the printer 300 shifts to the DPP respondent state. The DPPrespondent state is a state of being capable of responding to anauthentication request (that is, DPP Authentication Request to bedescribed later) sent from the first terminal 100 in response to the QRCode displayed in T100 being captured by the first terminal 100. Inparticular, the DPP respondent state in T110 is a state of being capableof responding to the authentication request using only the DPP channelamong the plurality of channels. In other words, in the DPP respondentstate in T110, the printer 300 stands by for the authentication requestat the DPP channel. That is, the printer 300 sends an authenticationresponse (that is, a DPP Authentication Response to be described later)in response to receiving the authentication request using the DPPchannel, but does not send any authentication response in response to anauthentication request at any channel other than the DPP channel. Here,“not send any authentication response in response to an authenticationrequest” includes the printer 300 not being capable of receiving theauthentication request as well as the printer 300 being capable ofreceiving the authentication request but configured not to send theauthentication response even when the authentication request isreceived.

In response to accepting an operation by the user, the first terminal100 activates the camera 110 and captures the QR Code displayed in T100using the camera 110. Further, in T122, the first terminal 100 decodesthe captured QR Code and obtains the public key PPK1, the channelinformation, and the MAC address “macpr”. When the process of T122 iscompleted, the process of FIG. 3 is terminated.

(Authentication (Auth); FIG. 4)

Next, the process of the Auth executed in T30 of FIG. 2 will bedescribed with reference to FIG. 4. All the communication as hereinafterexecuted between the first terminal 100 and the printer 300 isimplemented via the Wi-Fi I/F 106 of the first terminal 100 and theWi-Fi I/F 306 of the printer 300. Therefore, hereinafter, thedescription “via the Wi-Fi I/F 106 (or 306)” will be omitted.

In T200, the first terminal 100 generates a public key TPK1 and aprivate key tsk1 of the first terminal 100. Next, in T202, the firstterminal 100 generates a shared key SK1 according to Elliptic curveDiffie-Hellman key exchange (ECDH) by using the generated private keytsk1 and the public key PPK1 of the printer 300 obtained in T122 of FIG.3. Then, in T204, the first terminal 100 generates encrypted data ED1 byusing the generated shared key SKI to encrypt a random value RV1.

In T210, the first terminal 100 sends an Authentication Request(hereinafter abbreviated to “AReq”) to the printer 300 by setting theMAC address “macpr” obtained in T122 of FIG. 3 as its destination. TheAReq is a signal for requesting the printer 300 to executeauthentication. The AReq includes the public key TPK1 of the firstterminal 100 generated in T200, the encrypted data ED1 generated inT204, and a capability of the first terminal 100. Here, the firstterminal 100 repeats sending the AReq to the printer 300 using the DPPchannel indicated by the channel information obtained in T122 of FIG. 3.

The capability is information that is pre-designated in a devicesupporting the DPP scheme, and includes any one of the following values:a value indicating that this device is capable of operating only as aConfigurator according to the DPP scheme, a value indicating that thisdevice is capable of operating only as an Enrollee according to the DPPscheme, and a value indicating that this device is capable of operatingwhichever one of the Configurator and the Enrollee. The Configuratorrefers to a device configured to send a CO used in the NA (e.g., T40 ofFIG. 2) to an Enrollee in the Config (e.g., T35 of FIG. 2). On the otherhand, the Enrollee refers to a device that receives the CO used in theNA from the Configurator in the Config. As above, in the presentembodiment, the first terminal 100 generates the AP-CO and theprinter-CO and sends them respectively to the AP 10 and the printer 300.As such, the capability of the first terminal 100 includes the valueindicating that it is capable of operating only as the Configurator.

The printer 300 receives the AReq from the first terminal 100 in T210.As above, this AReq is sent with the MAC address “macpr” of the printer300 as the destination. As such, the printer 300 can suitably receivethe AReq from the first terminal 100.

Further, the AReq is sent by using the DPP channel as above. Since theprinter 300 shifts to the state standing by for the AReq using the DPPchannel in T110 of FIG. 3, the printer 300 can suitably receive the ARequsing the DPP channel from the first terminal 100. Here, a comparativeexample is assumed in which a QR Code including channel informationindicating two or more channels is displayed in T100 of FIG. 3, and theprinter 300 shifts to a state standing by for the AReq while switchingthe two or more channels in T110 of FIG. 3. In this case, the printer300 cannot receive an AReq unless a period during which the printer 300stands by for the AReq using a certain channel and a timing when theARes using this certain channel is sent from the first terminal 100match each other. Due to this, some time may be required before theprinter 300 receives the AReq. Contrary to this, in the presentembodiment, since the printer 300 shifts to a state standing by for theAReq using only the DPP channel that is one channel, the printer 300 canreceive the AReq using the DPP channel from the first terminal 100 morepromptly than the comparative example. Further, the DPP channel is usedin all the communication to be implemented as below between the firstterminal 100 and the printer 300.

Next, the printer 300 executes following processes for authenticatingthe sender of the AReq (that is, the first terminal 100). Specifically,in T212, the printer 300 generates a shared key SK1 according to theECDH by using the public key TPK1 of the first terminal 100 in the AReqand the private key psk1 of the printer 300. Here, the shared key SKIgenerated by the first terminal 100 in T202 and the shared key SK1generated by the printer 300 in 1212 are identical to each other. Thus,the printer 300 can suitably decrypt the encrypted data ED1 in the AReqby using the generated shared key SK1 in T214, as a result of which itcan obtain the random value RV1. In a case where the decryption of theencrypted data ED1 succeeds, the printer 300 determines that the senderof the AReq is the device that captured the QR Code displayed in T100 ofFIG. 3, that is, determines that the authentication succeeded, andexecutes subsequent processes from T216. On the other hand, in a casewhere the decryption of the encrypted data EDI does not succeed, theprinter 300 determines that the sender of the AReq is not the devicethat captured the QR Code displayed in T100, that is, determines thatthe authentication failed, and does not execute the subsequent processesfrom T216.

In T216, the printer 300 generates a new public key PPK2 and a newprivate key psk2 of the printer 300. In a variant, the public key PPK2and the private key psk2 may be stored in advance in the printer 300.Next, in T217, the printer 300 generates a shared key SK2 according tothe ECDH by using the public key TPK1 of the first terminal 100 in theAReq of T210 and the generated private key psk2 of the printer 300.Then, in 1218, the printer 300 generates encrypted data ED2 by using thegenerated shared key SK2 to encrypt the obtained random value RV1 and anew random value RV2.

In T220, the printer 300 sends an Authentication Response (hereinafterabbreviated to “ARes”) to the first terminal 100. This ARes includes thepublic key PPK2 of the printer 300 generated in T216, the encrypted dataED2 generated in T218, and a capability of the printer 300. Thiscapability includes the value indicating that the printer 300 is capableof operating only as the Enrollee.

In T220, the first terminal 100 receives the ARes from the printer 300.In this case, the first terminal 100 executes processes forauthenticating the sender of the ARes (that is, the printer 300).Specifically, firstly in 1222, the first terminal 100 generates a sharedkey SK2 according to the ECDH by using the private key tsk1 of the firstterminal 100 generated in T200 and the public key PPK2 of the printer300 in the ARes. Here, the shared key SK2 generated by the printer 300in T217 and the shared key SK2 generated by the first terminal 100 in1222 are identical to each other. Thus, the first terminal 100 cansuitably decrypt the encrypted data ED2 in the ARes by using thegenerated shared key SK2 in T224, as a result of which it can obtain therandom values RV1 and RV2. In a case where the decryption of theencrypted data ED2 succeeds, the first terminal 100 determines that thesender of the ARes is the device that displayed the captured QR Code,that is, determines that the authentication succeeded, and executessubsequent processes from T230. On the other hand, in a case where thedecryption of the encrypted data ED2 does not succeed, the firstterminal 100 determines that the sender of the ARes is not the devicethat displayed the captured QR Code, that is, determines that theauthentication failed, and does not execute the subsequent processesfrom T230.

In T230, the first terminal 100 sends a Confirm to the printer 300. TheConfirm includes information indicating that the first terminal 100operates as the Configurator and the printer 300 operates as theEnrollee. As a result, the first terminal 100 determines to operate asthe Configurator in T232, and the printer 300 determines to operate asthe Enrollee in 1234. When the process of T234 is completed, the processof FIG. 4 is terminated.

(Configuration (Config); FIG. 5)

Next, the process of the Config executed in T35 of FIG. 2 will bedescribed with reference to FIG. 5. In T300, the printer 300 sends a DPPConfiguration Request (hereinafter abbreviated to “CReq”) to the firstterminal 100. This CReq is a signal requesting the printer-CO to be sent

The first terminal 100 receives the CReq from the printer 300 in T300.In this case, the first terminal 100 generates a new public key TPK2 anda new private key tsk2 of the first terminal 100 in T302. Next, in T304,the first terminal 100 generates the printer-CO by using the generatedprivate key tsk2. Specifically, the first terminal 100 executesfollowing processes.

Firstly, the first terminal 100 generates a hash value HV by hashing thepublic key TPK2 of the first terminal 100. Further, the first terminal100 generates a specific value by hashing a combination of the hashvalue HV, the group ID “Group”, and the public key PPK2 of the printer300 in the ARes in T220 of FIG. 4. Then, the first terminal 100generates a digital signature DSpr by using the private key tsk2 of thefirst terminal 100 to encrypt the generated specific value according toan Elliptic Curve Digital Signature Algorithm (ECDSA). As a result, thefirst terminal 100 can generate a Signed-Connector for printer(hereinafter, the Signed-Connector is abbreviated to “SC”) including thehash value HV, the group ID “Group”, the public key PPK2 of the printer300, and the digital signature DSpr. Further, the first terminal 100generates the printer-CO including the SC for printer (hereafter,“printer-SC”) and the public key TPK2 of the first terminal 100.

In T310, the first terminal 100 sends a DPP Configuration Response(hereinafter abbreviated to “CRes”) including the printer-CO to theprinter 300.

The printer 300 receives the CRes from the first terminal 100 in T310.In this case, the printer 300 stores the printer-CO in the CRes in T312.The printer-CO is information that is to be used in the DPP connectionwith the AP 10 and can be called connection information for establishingthe DPP connection with the AP 10. When the process of T312 iscompleted, the process of FIG. 5 is terminated.

(Network Access (NA); FIG. 6)

Next, the process of the NA in T40 of FIG. 2 will be described withreference to FIG. 6. As aforementioned, the processes of T5 to T15 ofFIG. 2 have already been executed between the first terminal 100 and theAP 10, similarly to T25 to T35 of FIG. 2. The AP 10 stores in advance apublic key APK1 and a private key ask1 of the AP 10. Further, a QR Code,which is obtained by coding the public key APK1 of the AP 10, channelinformation of the AP 10, and a MAC address of the AP 10, is adhered toa housing of the AP 10. Processes similar to the processes from T200 ofFIG. 4 are executed between the first terminal 100 and the AP 10 whenthe first terminal 100 captures this QR Code. As a result, the AP 10stores a public key APK2 and a private key ask2 of the AP 10 (see T216of FIG. 4), and further stores the AP-CO received from the firstterminal 100 (see T312 of FIG. 5). The AP-CO includes a SC for AP(hereafter, “AP-SC”) and a public key TPK2 of the first terminal 100.This public key TPK2 is identical to the public key TPK2 included in theprinter-CO. Further, the AP-SC includes a hash value HV, a group ID“Group”, the public key APK2 of the AP 10, and a digital signature DSap.This hash value HV and this group ID “Group” are respectively identicalto the hash value HV and the group ID “Group” included in theprinter-CO. The digital signature DSap is information in which aspecific value, which is obtained by hashing a combination of the hashvalue HV, the group ID “Group”, and the public key APK2, are encryptedby the private key tsk2 of the first terminal 100, and is a valuedifferent from the digital signature DSpr included in the printer-CO.

In T400, the printer 300 sends a DPP Peer Discovery Request (hereinafterabbreviated to “DReq”) including the printer-SC to the AP 10. The DReqis a signal requesting the AP 10 to execute authentication and send theAP-SC.

In response to receiving the DReq from the printer 300 in T400, the AP10 executes a process for authenticating the sender of the DReq (thatis, the printer 300) and the respective kinds of information in the DReq(that is, the hash value HV, the “Group”, and the public key PPK2).Specifically, in T402, the AP 10 firstly executes a first APdetermination process that is regarding whether or not the hash value HVand the group ID “Group” in the received printer-SC are respectivelyidentical to the hash value HV and the group ID “Group” in the AP-SCincluded in the stored AP-CO. In the case of FIG. 6, the AP 10determines “identical” in the first AP determination process, thus itdetermines that the authentication of the sender of the DReq (that is,the printer 300) succeeds. Here, the fact that the hash value HV in thereceived printer-SC is identical to the hash value HV in the AP-SCincluded in the stored AP-CO means that the printer-SC and the AP-SCwere generated by the same device (that is, the first terminal 100). Assuch, the AP 10 also determines that authentication of the creator ofthe received printer-SC (that is, the first terminal 100) succeeds.

Further, the AP 10 decrypts the digital signature DSpr in the receivedprinter-SC by using the public key TPK2 of the first terminal 100included in the stored AP-CO. Since the decryption of the digitalsignature DSpr succeeds in the case of FIG. 6, the AP 10 executes asecond AP determination process that is regarding whether or not aspecific value obtained by decrypting the digital signature DSpr isidentical to a value obtained by hashing the respective kinds ofinformation in the received printer-SC (that is, the hash value HV, the“Group”, and the public key PPK2). In the case of FIG. 6, the AP 10determines “identical” in the second AP determination process, thus itdetermines that the authentication of the respective kinds ofinformation in the DReq succeeds, and executes processes from T404. Thefact that the AP 10 determines “identical” in the second APdetermination process means that the respective kinds of information inthe received printer-SC (that is, the hash value HV, the “Group”, andthe public key PPK2) has not been tampered with by a third party sincethe printer-CO was stored in the printer 300. On the other hand, in acase where the AP 10 determines “not identical” in the first APdetermination process, in a case where the decryption of the digitalsignature DSpr fails, or in a case where the AP 10 determines “notidentical” in the second AP determination process, the AP 10 determinesthat the authentication fails and does not execute the processes fromT404.

Next, in T404, the AP 10 generates a connection key CK (that is, ashared key) by using the obtained public key PPK2 of the printer 300 andthe stored private key ask2 of the AP 10 according to the ECDH.

In T410, the AP 10 sends a DPP Peer Discovery Response (hereinafterabbreviated to “DRes”) including the AP-SC to the printer 300.

In response to receiving the DRes from the AP 10 in T410, the printer300 executes a process for authenticating the sender of the DRes (thatis, the AP 10) and the respective information in the DRes (that is, thehash value HV, the “Group”, and the public key APK2). Specifically, inT412, the printer 300 firstly executes a first PR determination processthat is regarding whether or not the hash value HV and the group ID“Group” in the received AP-SC are respectively identical to the hashvalue HV and the group ID “Group” in the printer-SC included in thestored printer-CO. In the case of FIG. 6, the printer 300 determines“identical” in the first PR determination process, thus it determinesthat the authentication of the sender of the DRes (that is, the AP 10)succeeds. The fact that the hash value HV in the received AP-SC isidentical to the hash value HV in the printer-SC included in the storedprinter-CO means that the printer-SC and the AP-SC were generated by thesame device (that is, the first terminal 100). As such, the printer 300also determines that authentication of the creator of the received AP-SC(that is, the first terminal 100) succeeds.

Further, the printer 300 decrypts the digital signature DSap in thereceived AP-SC by using the public key TPK2 of the first terminal 100included in the stored printer-CO. Since the decryption of the digitalsignature DSap succeeds in the case of FIG. 6, the printer 300 executesa second PR determination process that is regarding whether or not aspecific value obtained by decrypting the digital signature DSpr isidentical to a value obtained by hashing the respective information inthe received AP-SC (that is, the hash value HV, the “Group”, and thepublic key APK2). In the case of FIG. 6, the printer 300 determines“identical” in the second PR determination process, thus it determinesthat the authentication of the information in the DRes succeeds, andexecutes processes from T414. The fact that the printer 300 determines“identical” in the second PR determination process means that therespective information in the received AP-SC (that is, the hash valueHV, the “Group”, and the public key APK2) has not been tampered with bya third party since the AP-CO was stored in the AP 10. On the otherhand, in a case where the printer 300 determines “not identical” in thefirst PR determination process, in a case where the decryption of thedigital signature DSap fails, or in a case where the printer 300determines “not identical” in the second PR determination process, theprinter 300 determines that the authentication fails and does notexecute the processes from T414.

In T414, the printer 300 generates a connection key CK by using thestored private key psk2 of the printer 300 and the public key APK2 ofthe AP 10 in the received AP-SC according to the ECDH. Here, theconnection key CK generated by the AP 10 in T404 and the connection keyCK generated by the printer 300 in T414 are identical to each other.Thus, the connection key CK for establishing the DPP connection isshared between the printer 300 and the AP 10.

As aforementioned, after the connection key CK is shared between theprinter 300 and the AP 10, the printer 300 and the AP 10 execute the4way-handshake communication by using the connection key CK in T420. Asa result, the DPP connection is established between the printer 300 andthe AP 10. A channel to be used in communication via this DPP connectionis a channel which is one of 1ch to 13ch as determined by the AP 10.That is, this channel may be same as the aforementioned DPP channel asabove, or may be different from the aforementioned DPP channel.

After this, the printer 300 shifts to a DPP non-respondent state (i.e. astate before T110 of FIG. 3) in T430. The DPP non-respondent state is astate not responding to any authentication request (i.e. AReq) usingwhichever channel. That is, the DPP non-respondent state is a state notstanding by for the authentication request. When the process of T430 iscompleted, the process of FIG. 6 is terminated.

(Overview of WFD; FIG. 7)

Next, an overview of WFD will be described with reference to FIG. 7. Asaforementioned, the second terminal 200 and the printer 300 support theWFD scheme, and the WFD connection is established between the secondterminal 200 and the printer 300. All the communication as hereinafterexecuted between the second terminal 200 and the printer 300 isimplemented via the Wi-Fi I/F 206 of the second terminal 200 and theWi-Fi I/F 306 of the printer 300. Therefore, hereinafter, thedescription “via the Wi-Fi I/F 206 (or 306)” will be omitted.

In T500, the printer 300 shifts to a WFD respondent state, which is adevice state in the WFD scheme. The WFD respondent state is a statebeing capable of responding to a Probe Request (hereinafter abbreviatedto “PReq”) that is sent from the second terminal 200. The PReq is asignal for searching for peripheral device(s) of the second terminal200. Especially, the WFD respondent state of T500 is a state beingcapable of responding to the PReq using only one channel among 1ch, 6ch,and 11ch (hereinafter termed “Listen channel”). In other words, the WFDrespondent state of T500 is a standby state for receiving the PReq usingthe Listen channel. That is, the printer 300 sends a Probe Response(hereinafter abbreviated to “PRes”) in response to receiving the PRequsing the Listen channel, but does not send the PRes in response to thePReq using a channel different from the Listen channel. Here, “not sendthe PRes in response to the PReq” includes not being capable ofreceiving the PReq as well as being capable of receiving the PReq butconfigured not to send the PRes even when the PReq is received.Hereinafter, the three channels, namely the 1ch, 6ch, and 11ch, will betermed “social channels”.

In T510, the second terminal 200 accepts a WFD connection operation fromthe user. The WFD connection operation is, for example, a user operationto activate the application for the WFD connection installed in thesecond terminal 200. The second terminal 200 shifts to the WFDrespondent state in T520 in response to accepting the WFD connectionoperation.

In T530, the second terminal 200 executes Search according to the WFDscheme. Specifically, the second terminal 200 sends the PReq bybroadcast. Here, the second terminal 200 repeats to send the PReq bysequentially using the social channels (i.e., 1ch, 6ch, and 11ch).

When a channel in which the printer 300 stands by for the PReq and achannel used in sending of the PReq from the second terminal 200 match,the printer 300 receives the PReq from the second terminal 200 in T530.In this case, in T532, the printer 300 sends the PRes including a devicename “printer AAA” of the printer 300 to the second terminal 200.

The second terminal 200 receives the PRes from the printer 300 in T532.Although omitted from the drawings, the second terminal 200 may alsoreceive the PRes from other device(s). Then, in T540, the secondterminal 200 displays a search result indicating one or more devicenames included in the one or more PRes received in T532. In the exampleof FIG. 7, the search result includes “printer AAA” and “terminal BBB”.

In T542, the second terminal 200 accepts a user selection of “printerAAA” included in the search result displayed in T540. In this case, aG/O negotiation is executed between the second terminal 200 and theprinter 300 in T550 and T552. The G/O negotiation is communication fordetermining which one of the second terminal 200 and the printer 300 isto be in the G/O state.

Specifically, the second terminal 200 sends a G/O Negotiation Request(hereinafter abbreviated to “GNReq”) to the printer 300 in T550. TheGNReq includes an Intent value of the second terminal 200. The Intentvalue is a value that is one of values ranging from 1 to 15, andrepresents a degree of facility of shifting to the G/O state.

The printer 300 receives the GNReq from the second terminal 200 in T550.In this case, the printer 300 sends a G/O Negotiation Response(hereinafter abbreviated to “GNRes”) to the second terminal 200 in T552.The GNRes includes an Intent value of the printer 300.

After this, the second terminal 200 and the printer 300 respectivelycompare the Intent value of the second terminal 200 and the Intent valueof the printer 300 and determine which one of them is to be in the G/Ostate. In a case where the Intent value of the printer 300 is greaterthan the Intent value of the second terminal 200, the second terminal200 determines to be in the CL state in T560 and the printer 300determines to be in the G/O state in T562. On the other hand, in a casewhere the Intent value of the printer 300 is smaller than the Intentvalue of the second terminal 200, the second terminal 200 determines tobe in the G/O state in T580 and the printer 300 determines to be in theCL state in T582.

When the G/O negotiation is completed, respective types of communicationsuch as Wi-Fi Protected Setup (WPS), Authentication, Association, and4-way handshake, are executed between the second terminal 200 and theprinter 300. As a result, in T570 or T590, a WFD connection isestablished between the second terminal 200 and the printer 300. Achannel to be used in communication via the WFD connection is a channelwhich is one of 1ch to 13ch as determined by the device in the G/Ostate. That is, this channel may be same as the aforementioned Listenchannel, or may be different from the aforementioned Listen channel.

After the WFD connection is established in T570, the printer 300maintains the WFD respondent state which is the G/O state. Specifically,this WFD respondent state is a state being capable of responding to thePReq using only the channel used in the WFD connection established inT570 (i.e., the channel determined by the printer 300 being in the G/Ostate). That is, the WFD respondent state is a standby state for thePReq using the aforementioned channel.

On the other hand, after the WFD connection is established in T590, theprinter 300 shifts to a WFD non-respondent state (i.e., a state beforeT500 of FIG. 7) in T592. This is because the printer 300 in the CL statecannot respond to the PReq. The WFD non-respondent state is a state notresponding to any PReq using whichever channel. The process of FIG. 7 isterminated when the process of T570 or T592 is completed.

As aforementioned, the printer 300 is capable of shifting to the DPPrespondent state (T110 of FIG. 3) as well as shifting to the WFDrespondent state (T500 of FIG. 7). Further, the present embodimentassumes a situation in which the printer 300 shifts to the WFDrespondent state when it has been maintaining the DPP respondent state.In such a situation, if the channel used in the DPP respondent state andthe channel used in the WFD respondent state are different, the printer300 stands by for the AReq or the PReq while sequentially switchingthese channels. In this case, the printer 300 cannot receive the ARequnless a period during which the printer 300 stands by for the ARequsing a certain channel and a timing when the AReq using this certainchannel is sent from the first terminal 100 match each other. Further,the printer 300 cannot receive the PReq unless a period during which theprinter 300 stands by for the PReq using a certain channel and a timingwhen the PReq using this certain channel is sent from the secondterminal 200 match each other. Due to this, some time may be requiredbefore the printer 300 receives the AReq or the PReq. To suppress such asituation from happening, the printer 300 executes the process of FIG.8.

(State Shifting Process of Printer 300; FIG. 8)

A state shifting process executed by the CPU 322 of the printer 300 willbe described with reference to FIG. 8. The CPU 322 obtains a power-ONinstruction when a power button included in the operation unit 302 ofthe printer 300 is operated by the user in a state where power of theprinter 300 is off. In this case, the CPU 322 initiates the process ofFIG. 8.

In S100, the CPU 322 displays a QR Code on the display unit 304. Here,the memory 324 stores in advance, before when the printer 300 wasshipped, the QR Code that includes the public key PPKI, the channelinformation indicating 1ch (i.e., the DPP channel) determined in advancefrom among the social channels (i.e., 1ch, 6ch, 11ch), and the MACaddress “macpr”. Further, the CPU 322 obtains the QR Code from thememory 324 and supplies this QR Code to the display unit 304, by whichit causes the display unit 304 to display the QR Code.

In S102, the CPU 322 causes the state of the printer 300 to shift fromthe DPP non-respondent state to the DPP respondent state. Especially,the DPP respondent state in S102 is the state being capable ofresponding to the AReq using only 1ch being the DPP channel. Byinstructing the Wi-Fi I/F 306 that a shift to the DPP respondent statein which only 1ch is used, that is, a shift to the standby state for theAReq using 1ch should be executed, the CPU 322 causes the state of theprinter 300 to shift to the DPP respondent state.

In S110, S120, S130, and S140, the CPU 322 monitors acquisition ofvarious instructions. In a case where a DPP disabling button included inthe operation unit 302, 304 of the printer 300 is operated by the userwhile the state of the printer 300 is the DPP respondent state, the CPU322 determines as having obtained a DPP disabling instruction (YES toS110) and proceeds to S112.

In S112, the CPU 322 stops displaying the QR Code and causes the stateof the printer 300 to shift from the DPP respondent state to the DPPnon-respondent state. Specifically, the CPU 322 instructs the Wi-Fi I/F306 to shift to the DPP non-respondent state, that is, to shift to thestate of not standing by for the AReq. When the process of S112 iscompleted, the CPU 322 returns to monitoring such as in S110.

In a case where a DPP enabling button included in the operation unit302, 304 of the printer 300 is operated by the user while the state ofthe printer 300 is the DPP non-respondent state, the CPU 322 determinesthat a DPP enabling instruction has been obtained (YES to S120) andexecutes S100 and S102.

In a case where a WFD enabling button included in the operation unit302, 304 of the printer 300 is operated by the user while the state ofthe printer 300 is the WFD non-respondent state, the CPU 322 determinesthat a WFD enabling instruction has been obtained (YES to S130) andproceeds to S132.

In S132, the CPU 322 determines whether the state of the printer 300 isthe DPP respondent state or the DPP non-respondent state. The CPU 322proceeds to S134 in a case of determining that the state of the printer300 is the DPP respondent state (YES to S132) and proceeds to S136 in acase of determining that the state of the printer 300 is the DPPnon-respondent state (NO to S132).

In S134, the CPU 322 causes the state of the printer 300 to shift fromthe WFD non-respondent state to the WFD respondent state. Especially,the WFD respondent state in S134 is the device state in the WFD scheme,and is a state being capable of responding to the PReq using only 1ch(i.e., the Listen channel) that is same as the DPP channel used in theDPP respondent state. By instructing the Wi-Fi I/F 306 to shift to theWFD respondent state that uses 1ch only, that is, to shift to thestandby state for the PReq using 1ch, the CPU 322 causes the state ofthe printer 300 to shift to the WFD respondent state. When the processof S134 is completed, the CPU 322 returns to the monitoring such as inS110.

In S136, the CPU 322 selects one channel (i.e., the Listen channel) tobe used in the WFD respondent state from among the social channels(i.e., 1ch, 6ch, and 11ch). Specifically, the CPU 322 firstly sends thePReq using 1ch by broadcast, and counts a number of the PRes received inresponse to this PReq. Similarly, the CPU 322 sends the PReq and countsthe number of the PRes for 6ch and 11ch as well. Then, the CPU 322selects a channel among the social channels with a smallest number ofthe counted PRes, that is, a channel that is currently least used aroundthe printer 300, as the Listen channel.

In S138, the CPU 322 causes the state of the printer 300 to shift fromthe WFD non-respondent state to the WFD respondent state. Especially,the WFD respondent state in S138 is the device state in the WFD scheme,and is a state being capable of responding to the PReq using only thechannel selected in S136 (i.e., the Listen channel). By instructing theWi-Fi I/F 306 to shift to the WFD respondent state using the selectedchannel only, that is, to shift to the standby state for the PReq usingthe selected channel, the CPU 322 causes the state of the printer 300 toshift to the WFD respondent state. When the process of S138 iscompleted, the CPU 322 returns to the monitoring such as in S110.

In a case where a WFD disabling button included in the operation unit302, 304 of the printer 300 is operated by the user, the CPU 322determines that a WFD disabling instruction has been obtained (YES toS140) and proceeds to S142.

In S142, the CPU 322 causes the state of the printer 300 to shift fromthe WFD respondent state to the WFD non-respondent state. Specifically,the CPU 322 instructs the Wi-Fi I/F 306 to shift to the WFDnon-respondent state, that is, to a state not standing by for the PReq.When the process of S142 is completed, the CPU 322 returns to themonitoring such as in S110.

(Case A; FIG. 9)

Next, specific cases realized by the process of FIG. 8 will bedescribed. Firstly, Case A in which the printer 300 shifts to the WFDrespondent state in a situation of having been in the DPP respondentstate will be described with reference to FIG. 9. The BS, Auth, andConfig of the DPP scheme are executed between the first terminal 100 andthe AP 10. These processes are similar to those of T5 to T15 of FIG. 2.

When the printer 300 obtains the power-ON instruction (trigger for theprocess of FIG. 8) in T620, the printer 300 displays the QR Code (S100)in T622 and shifts to the DPP respondent state (S102). Especially, theDPP respondent state in T622 is the state being capable of responding tothe AReq using only 1ch being the DPP channel.

When the WFD enabling instruction is obtained in T624 (YES to S130), theprinter 300 shifts to the WFD respondent state (YES to S132, S134). TheWFD respondent state of T626 is a state being capable of responding tothe PReq using only 1ch being the same Listen channel as the DPPchannel.

T635 to T650 are similar to T25 to T40 of FIG. 2 except that 1ch is usedas the DPP channel in the Auth process between the printer 300 and thefirst terminal 100. Thus, the DPP connection is established between theprinter 300 and the AP 10.

The processes of T660 to T670 are similar to the processes of T510 toT530 of FIG. 7. When the PReq using 1ch is received from the secondterminal 200 in T670, the printer 300 sends the PRes using 1ch to thesecond terminal 200 in T672.

The processes of T680 and T682 are similar to the processes of T540 andT542 of FIG. 7. After this, the G/O negotiation is executed between theprinter 300 and the second terminal 200 (omitted from FIG. 9, see T550and T552 of FIG. 7), and then in T690, the WFD connection is establishedbetween the printer 300 and the second terminal 200.

As shown in Case A above, in the case of obtaining the WFD enablinginstruction (T624) while being in the DPP respondent state being capableof responding to the AReq using 1ch being the DPP channel, the printer300 shifts to the state being capable of responding to the AReq using1ch and also capable of responding to the PReq using 1ch (T626). Thus,the printer 300 can stand by for the AReq and the PReq in a samechannel. According to this, the printer 300 can promptly receive theAReq and the PReq in T640 and T670 as compared to a configuration inwhich the channel used in the DPP respondent state and the channel usedin the WFD respondent state are different. As such, according to thepresent embodiment, the printer 300 can shift to the state of standingby for signals using a suitable channel.

Further, in the present embodiment, the printer 300 uses 1ch that isdetermined in advance as the DPP channel. That is, the printer 300 fixesthe DPP channel used in the DPP respondent state to 1ch. Due to this,the vendor of the printer 300 can store in advance the QR Code displayedin T622 (i.e., the QR Code including the channel information indicating1ch) in the memory 324. As a result of this, the printer 300 can displaythe prestored QR Code in T622. As such, the printer 300 does not have toexecute the process of generating the QR Code, which enables it todisplay the QR Code promptly.

(Case B; FIG. 10)

Next, Case B in which the printer 300 shifts to the WFD respondent statein a situation of having been in the DPP non-respondent state will bedescribed with reference to FIG. 10.

The processes of T720 and T722 are similar to the processes of T620 andT622 of FIG. 9. When the DPP disabling instruction is obtained in T723(YES to S110 of FIG. 8), the printer 300 shifts to the DPPnon-respondent state in T724 (S112).

When the WFD enabling instruction is obtained in T726 (YES to S130, NOto S132), the printer 300 sends the PReq by broadcast by sequentiallyusing the social channels (i.e., 1ch, 6ch, 11ch) in T730 (S136). Then,in T732, the printer 300 receives the PRes in each channel and countsthe number of the PRes in each channel. In the case of FIG. 10, thenumber of the PRes is smallest in 6ch, thus the printer 300 selects 6chas the Listen channel in T740 (S136).

In T742, the printer 300 shifts to the WFD respondent state (S138). TheWFD respondent state of T742 is a state being capable of responding tothe PReq using only 6ch selected in T740. The processes of T760 to T770are similar to the processes of T510 to T530 of FIG. 7. When the PRequsing 6ch is received from the second terminal 200 in T770, the printer300 sends the PRes using 6ch to the second terminal 200 in T772. Theprocesses of T780 to T790 are similar to the processes of T680 to T690of FIG. 9.

As indicated in Case B above, in the case of obtaining the WFD enablinginstruction (T726) while being in the DPP non-respondent state, theprinter 300 selects the currently least used channel around the printer300 from among the social channels (T730 to T740) and shifts to the WFDrespondent state being capable of responding to the PReq using only theselected channel (T742). Due to this, the printer 300 can suitablyreceive the PReq from the second terminal 200 as compared to aconfiguration of using a channel that is used frequently around theprinter 300.

(Corresponding Relationship)

The printer 300 is an example of a “communication device”. The firstterminal 100, the AP 10, and the second terminal 200 are respectively anexample of a “terminal device”, a “first external device”, and a “secondexternal device”. The display unit 304 and the Wi-Fi I/F 306 arerespectively an example of an “output unit” and a “wireless interface”.The QR Code and 1ch, are respectively an example of “output-information”and a “target channel”. The DPP scheme and the WFD scheme arerespectively an example of a “first scheme” and a “second scheme”. TheWi-Fi connection established in T650 and the Wi-Fi connectionestablished in T690 of FIG. 9 are respectively an example of a “firstwireless connection” and a “second wireless connection”. The AReq, theARes, the PReq, and the PRes are respectively an example of an“authentication request”, an “authentication response”, a “searchsignal”, and a “search response”.

The power-OFF state of the printer 300 (i.e., being in the DPPnon-respondent state and the WFD non-respondent state) is an example ofa “first state”. Being in the DPP respondent state and the WFDnon-respondent state (the state in T622 of FIG. 9) is an example of a“second state”. Being in the DPP respondent state and the WFD respondentstate (the state in T626 of FIG. 9) is an example of a “third state”.Being in the DPP non-respondent state and the WFD respondent state (thestate in T742 of FIG. 10) is an example of a “fourth state”. Thepower-ON instruction and the WFD enabling instruction are respectivelyan example of a “first instruction” and a “second instruction”.

The process of S100, the process of S102, the process of S134, theprocess of S136, and the process of S138 of FIG. 8 are respectively anexample of “executing an output control process”, “shifting the state ofthe communication device from the first state to a second state”,“shifting the state of the communication device from the second state toa third state”, “selecting one channel”, and “shifting the state of thecommunication device from the first state to a fourth state”. Theprocess of T220 of FIG. 4 and the process of T532 of FIG. 7 arerespectively an example of “sending an authentication response” and“sending a search response”. The process of T650 and the process of T690of FIG. 9 are respectively an example of “establishing a first wirelessconnection” and “establishing a second wireless connection”.

Second Embodiment

Next, a second embodiment will be described. In the present embodiment,a situation in which the printer 300 shifts to the DPP respondent statewhile being in the WFD respondent state will be assumed.

(State Shifting Process of Printer 300; FIG. 11)

In the present embodiment, the process of FIG. 11 is executed instead ofthe process of FIG. 8. The CPU 322 obtains the power-ON instruction whenthe power button included in the operation unit 302, 304 of the printer300 is operated by the user in the state where power of the printer 300is off. In this case, the CPU 322 initiates the process of FIG. 11.

S200 and S202 are similar to S136 and S138 of FIG. 8. That is, in thepresent embodiment, the CPU 322 shifts to the WFD respondent stateinstead of shifting to the DPP respondent state in the case of obtainingthe power-ON instruction.

In S210, S220, S230, and S250, the CPU 322 monitors acquisition ofvarious instructions. In the case where the WFD disabling buttonincluded in the operation unit 302, 304 of the printer 300 is selectedby the user while the state of the printer 300 is the WFD respondentstate, the CPU 322 determines that the WFD disabling instruction hasbeen obtained (YES to S210) and proceeds to S212. S212 is similar toS142 of FIG. 8. When the process of S212 is completed, the CPU 322returns to monitoring such as in S210.

In the case where the WFD enabling button included in the operation unit302, 304 of the printer 300 is operated by the user while the state ofthe printer 300 is the WFD non-respondent state, the CPU 322 determinesthat the WFD enabling instruction has been obtained (YES to S220) andexecutes S200 and S202.

In a case where the DPP enabling button included in the operation unit302, 304 of the printer 300 is operated by the user while the state ofthe printer 300 is the DPP non-respondent state, the CPU 322 determinesthat the DPP enabling instruction has been obtained (YES to S230) andproceeds to S232. S232 and S234 are similar to S100 and S102 of FIG. 8.

In S236, the CPU 322 determines whether the state of the printer 300 isthe WFD respondent state or the WFD non-respondent state. A case inwhich the state of the printer 300 is the WFD respondent state is eithera case where the printer 300 is in the device state of the WFD scheme ora case where the printer 300 is in the G/O state of the WFD scheme. TheCPU 322 proceeds to S238 in a case of determining that the state of theprinter 300 is the WFD respondent state (i.e., the device state or G/Ostate) (YES to S236), while the CPU 322 returns to the monitoring suchas in S210 in a case of determining that the state of the printer 300 isthe WFD non-respondent state (i.e., the CL state of the WFD scheme or astate in which communication according to the WFD scheme is disabled(see YES to S210)) (NO to S236).

In S238, the CPU 322 determines whether or not the Listen channelcurrently used in the WFD respondent state of the printer 300 matches1ch, which is the DPP channel. The CPU 322 proceeds to S240 in a case ofdetermining that the Listen channel does not match 1ch (NO to S238)while the CPU 322 returns to the monitoring such as in S210 in a case ofdetermining that the Listen channel matches 1ch (YES to S238).

In S240, the CPU 322 determines whether or not a WFD connection isestablished between the printer 300 and another device (such as thesecond terminal 200). The CPU 322 proceeds to S242 in a case ofdetermining that no WFD connection is established between the printer300 and another device (NO to S240) while the CPU 322 returns to themonitoring such as in S210 in a case of determining that the WFDconnection is established between the printer 300 and another device(YES to S240).

In S242, the CPU 322 causes the state of the printer 300 to shift fromthe current WFD respondent state to a new WFD respondent state. The newWFD respondent state is a state being capable of responding to the PRequsing only 1ch. That is, the CPU 322 changes the Listen channel to 1ch.When the process of S242 is completed, the CPU 322 returns to themonitoring such as in S210.

When the DPP disabling button included in the operation unit 302, 304 ofthe printer 300 is operated by the user, the CPU 322 determines that theDPP disabling instruction has been obtained (YES to S250) and proceedsto S252. S252 is similar to S112 of FIG. 8. When the process of S252 iscompleted, the CPU 322 returns to the monitoring such as in S210.

(Case C; FIG. 12)

Next, specific cases realized by the process of FIG. 11 will bedescribed. Firstly, Case C in which the printer 300 shills to the DPPrespondent state in a situation of having been in the WFD respondentstate being the device state will be described with reference to FIG.12.

When the printer 300 obtains the power-ON instruction in T820 (triggerfor the process of FIG. 11), the printer 300 executes processes similarto T730 to T740 of FIG. 10 and selects 6ch in the present case (S200).Then, in T824, the printer 300 shifts to the WFD respondent state(S202). The WFD respondent state of T824 is a state being capable ofresponding to the PReq using only 6ch, which have selected the Listenchannel.

When the DPP enabling instruction is obtained in T826 (YES to S230), theprinter 300 displays the QR Code (S232) in T828 and shifts to the DPPrespondent state (S234). Especially, the DPP respondent state in T828 isthe state being capable of responding to the AReq using only 1ch beingthe DPP channel

In T830, the printer 300 shifts from the WFD respondent state in which6ch is used (see T824) to the WFD respondent state in which 1ch is used(YES to S236, NO to S238, NO to S240, and S242). That is, the printer300 changes the Listen channel from 6ch to 1ch. The WFD respondent stateof T830 is a device state of the WFD scheme.

When the BS, Auth, and Config of the DPP scheme are executed between theprinter 300 and the first terminal 100 after the printer 300 has shiftedto the WFD respondent state, the DPP connection is established betweenthe printer 300 and the AP 10 in T850. These processes are similar toT635 to T650 of FIG. 9.

The processes of T860 to T890 are similar to T660 to T690 of FIG. 9.Thus, the WFD connection is established between the printer 300 and thesecond terminal 200.

As indicated in Case C above, in the case of obtaining the DPP enablinginstruction (T826) while being in the WFD respondent state being capableof responding to the PReq using 6ch, the printer 300 shifts to the statebeing capable of responding to the AReq using 1ch and also capable ofresponding to the PReq using 1ch (T828 and T830).Thus, the printer 300can stand by for the AReq and the PReq in the same channel. According tothis, the printer 300 can promptly receive the AReq and the PReq. Assuch, according to the present embodiment, the printer 300 can shift tothe state of standing by for signals using a suitable channel.

(Case D; FIG. 13)

Next, Case D in which the printer 300 shifts to the DPP respondent statein a situation of having been in the WFD respondent state being the G/Ostate and the WFD connection with another device having been establishedwill be described with reference to FIG. 13.

The processes of T920 to T924 are similar to the processes of T820 toT824 of FIGS. 12 (S200 and S202 of FIG. 11). Further, the processes ofT930 to T952 are similar to the processes of T860 to T882 of FIG. 12.However, since the printer 300 is in the WFD respondent state in which6ch is used, it sends the PRes in T942 in response to the PReq using6ch. T960 to T970 are similar to T550 to T570 of FIG. 7. In the presentcase, after having determined to enter the G/O state, the printer 300selects a channel to be used while the printer 300 is in the G/O statefrom among 1ch to 13ch as the new Listen channel. Specifically, theprinter 300 sequentially sends multiple PReq using each one of 1ch to13ch by broadcast, and counts the number of the PRes for each channel.Then, the printer 300 selects a channel among 1ch to 13ch with thesmallest number of the counted PRes, that is, a channel that iscurrently least used around the printer 300, as the Listen channel. Inthe case of FIG. 13, the printer 300 selects 7ch as the new Listenchannel. In this state, the printer 300 is capable of responding to thePReq using 7ch.

The processes of T980 and T982 are similar to the processes of T826 andT828 of FIG. 12 (YES to S230, S232, and S234). In this case, the printer300 determines that the Listen channel (i.e., 7ch) and the DPP channel(i.e., 1ch) are different (NO to S238), determines that the WFDconnection with the second terminal 200 is established (YES to S240),and maintains the Listen channel as 7ch. That is, in T982, the printer300 shifts to the DPP respondent state in which 1ch is used and the WFDrespondent state in which 7ch is used. In this case, the printer 300alternately repeats execution of the process of standing by for the ARequsing 1ch and the process of standing by for the PReq using 7ch.

After this, when the BS, Auth, and Config of the DPP scheme are executedbetween the printer 300 and the first terminal 100, the DPP connectionis established between the printer 300 and the AP 10 in T990. Theseprocesses are similar to the processes of T635 to T650 of FIG. 9.

As shown in Case D above, in the case where 7ch used in the WFDrespondent state and 1ch used in the DPP respondent state are differentand the WFD connection is established with the second terminal 200, theprinter 300 maintains the Listen channel as 7ch. This is because if theListen channel is changed from 7ch to 1ch, the WFD connection with thesecond terminal 200 would be disconnected. According to the presentembodiment, the printer 300 can suppress the WFD connection with thesecond terminal 200 from disconnecting.

(Case E; FIG. 14)

Next, Case E in which the printer 300 shifts to the DPP respondent statein a situation of having been in the WFD respondent state being the G/Ostate and no WFD connection having been established with another devicewill be described with reference to FIG. 14.

The processes of T1020 to T1070 are similar to the processes of T920 toT970 of FIG. 13. After this, in T1072, the WFD connection between theprinter 300 and the second terminal 200 is disconnected. For example,the WFD connection is disconnected when the second terminal 200 moves toa location away from the printer 300. Even though the WFD connectionwith the second terminal 200 has been disconnected, the printer 300maintains the G/O state until a predetermined time elapses. This isbecause there is a possibility that the second terminal 200 may comeback close to the printer 300 and re-establish the WFD connection withthe printer 300.

The processes of T1080 and T1082 are similar to the processes of T980and T982 of FIG. 13. In this case, the printer 300 determines that theListen channel (i.e., 7ch) and the DPP channel (i.e., 1ch) are different(NO to S238), and since no WFD connection with another device isestablished (NO to S240), the printer 300 changes the Listen channelfrom 7ch to 1ch in T1084 (S242).

After this, when the BS, Auth, and Config of the DPP scheme are executedbetween the printer 300 and the first terminal 100, the DPP connectionis established between the printer 300 and the AP 10 in T1090. Theseprocesses are similar to the processes of T635 to T650 of FIG. 9.

As shown in Case E above, in the case where 7ch used in the WFDrespondent state and 1ch used in the DPP respondent state are differentand no WFD connection is established with another device, the printer300 changes the Listen channel from 7ch to 1ch. Thus, the printer 300can stand by for the AReq and the PReq in the same channel. Due to this,the printer 300 can promptly receive the AReq and the PReq.

(Corresponding Relationship)

The 6ch channel selected in S200 of FIG. 11 or 7ch determined in T1064of FIG. 14 is an example of a “first channel”. Further, the DPP channel(i.e., 1ch) is an example of a “second channel”. The power-OFF state ofthe printer 300 (i.e., being in the DPP non-respondent state and the WFDnon-respondent state) is an example of the “first state”. Being in theDPP non-respondent state and the WFD respondent state (the state of T824of FIG. 12, the state of T924 of FIG. 13, or the state of T1024 of FIG.14) is an example of the “second state”. Being in the DPP respondentstate and the WFD respondent state in which the same channel is used(the state of T830 of FIG. 12 or the state of T1084 of FIG. 14) is anexample of the “third state”. The DPP enabling instruction and thepower-ON instruction are respectively an example of the “firstinstruction” and the “second instruction”.

The process of S200, the process of S202, the process of S232, and theprocess of S234 of FIG. 11 are respectively an example of “selecting thefirst channel”, “shifting the state of the communication device from thefirst state to a second state”, “executing an output control process”,and “shifting the state of the communication device from the secondstate to a third state”. The process of T850 and the process of T890 ofFIG. 12 are respectively an example of “establishing a first wirelessconnection” and “establishing a second wireless connection”.

(Variant 1) In S100 of FIG. 8, the printer 300 may cause the printexecuting unit 308 to execute printing of the QR Code instead ofdisplaying the QR Code. In this variant, the print executing unit 308 isan example of the “output unit” and a process of causing the printexecuting unit 308 to execute printing of the QR Code is an example ofthe “output control process”.

(Variant 2) Each of the printer 300 and the first terminal 100 mayfurther include a wireless interface (e.g., Bluetooth (RegisteredTrademark, BLUETOOTH SIG, INC.) (BT) I/F or Near Field Communication(NFC) I/F) according to a wireless scheme different from the Wi-Fischeme (e.g., BT scheme or an NFC scheme). In this case, in S100 of FIG.8, the printer 300 may for example instruct the BT I/F of the printer300 to send the DPP information including the public key PPK1, thechannel information, and the MAC address. In this case, the firstterminal 100 can receive the DPP information via the BT I/F of the firstterminal 100. In this variant, the BT I/F is an example of the “outputunit” and instructing the BT I/F to send the DPP information is anexample of the “output control process”. Further, in another variant,the printer 300 may cause the NFC I/F of the printer 300 to store theDPP information in S100 of FIG. 8. In this case, the first terminal 100can receive the DPP information via the NFC I/F of the first terminal100. In this variant, the NFC I/F is an example of the “output unit” andcausing the NFC I/F to store the DPP information is an example of the“output control process”.

(Variant 3) The trigger of the process of FIG. 8 may not be theacquisition of the power-ON instruction, and may be acquisition of theDPP enabling instruction. In this variant, the DPP enabling instructionis an example of the “first instruction”. Further, in another variant,the trigger of the process of FIG. 11 may not be the acquisition of thepower-ON instruction, and may be acquisition of the WFD enablinginstruction. In this variant, the WFD enabling instruction is an exampleof the “second instruction”.

(Variant 4) In each of the embodiments as above, the DPP channel isfixed to 1ch. Instead of this, the printer 300 may determine the DPPchannel by randomly selecting one channel from among the social channels(i.e., 1ch, 6ch, 11ch). In general terms, the “target channel” and the“second channel” may not be determined in advance from among theplurality of channels.

(Variant 5) In each of the above embodiments, the channel that iscurrently least used around the printer 300 is selected in S136 of FIG.8 or S200 of FIG. 11. Instead of this, the printer 300 may randomlyselect one channel from among the social channels (i.e., 1ch, 6ch, 11ch)in S136 of FIG. 8 or S200 of FIG. 11. In general terms, the “selectingone channel (or selecting the first channel)” simply needs to select onechannel from among the plurality of channels.

(Variant 6) S136 of FIG. 8 or S200 of FIG. 11 may be omitted, and theprinter 300 may shift to the WFD respondent state in which only thechannel determined in advance (such as 6ch) is used in S138 of FIG. 8 orS202 of FIG. 11. In this variant, the “selecting one channel (orselecting the first channel)” may be omitted.

(Variant 7) The printer 300 may not execute the G/O negotiation of theWFD scheme, and for example, in the case of obtaining the WFD enablinginstruction in T624 of FIG. 9, it may autonomously shift to the G/Ostate. In this case as well, the printer 300 simply needs to shift tothe WFD respondent state in which only 1ch is used.

(Variant 8) The printer 300 may not support the WFD scheme, and maysupport a so-called SoftAP scheme. That is, for example, the printer 300may operate as a SoftAP in a case of obtaining a SoftAP enablinginstruction in T624 of FIG. 9. In this case as well, the printer 300 maysimply shift to a SoftAP respondent state in which only 1ch is used(i.e., the state being capable of responding to the PReq using only1ch). In this variant, the SoftAP scheme is an example of the “firstscheme”. The G/O state of the WFD scheme and a state of operating as theSoftAP of the SoftAP scheme may collectively be expressed as a “parentstation state”.

(Variant 9) The printer 300 may not support the DPP scheme, and maysupport another scheme for establishing the Wi-Fi connection by usingthe public key, the authentication request, and the authenticationresponse. In general terms, the “first scheme” may not be limited to theDPP scheme.

(Variant 10) In each of the above embodiments, the DPP connectionbetween the printer 300 and the AP 10 is established using the firstterminal 100. Instead of this, the DPP connection between the printer300 and the first terminal 100 may be established using the firstterminal 100. That is, NA of T40 may be executed between the printer 300and the first terminal 100. In general terms, the “first externaldevice” may be a device (such as the AP 10) different from the “terminaldevice (such as the first terminal 100)” as in each of the aboveembodiments, or may be a device that is identical to the “terminaldevice” as in this variant.

(Variant 11) The “communication device” may not be the printer 300, butmay be another device such as a scanner, a multi-function peripheral, aportable terminal, a PC, and a server.

(Variant 12) In the above embodiments, the respective processes of FIGS.2 to 14 are executed by software (such as the program 326), however, atleast one of these processes may be realized by hardware such as a logiccircuit.

What is claimed is:
 1. A communication device comprising: a wirelessinterface configured to execute wireless communication according toWi-Fi standard; an output unit; and a controller configured to: executea process for establishing a wireless connection between thecommunication device and another device via the wireless interfaceaccording to a first scheme of the Wi-Fi standard; and execute a processfor establishing a wireless connection between the communication deviceand another device via the wireless interface according to a secondscheme of the Wi-Fi standard, the second scheme being different from thefirst scheme, wherein in a case where a first instruction for enablingcommunication according to the first scheme is obtained while a state ofthe communication device is a first state, the process for establishingthe wireless connection according to the first scheme includes:executing an output control process for causing the output unit toexternally output output-information according to the first scheme, theoutput-information being information obtained by using channelinformation indicating a target channel and a public key of thecommunication device, the target channel being one of a plurality ofchannels which the wireless interface is capable of using; and shiftingthe state of the communication device from the first state to a secondstate, the first state being a state in which the communication devicedoes not respond to an authentication request according to the firstscheme and does not respond to a search signal according to the secondscheme, the second state being a state in which the communication deviceis capable of responding to the authentication request using only thetarget channel among the plurality of channels and does not respond tothe search signal, wherein in a case where a second instruction forenabling a communication according to the second scheme is obtainedwhile the state of the communication device is the second state, theprocess for establishing the wireless connection according to the secondscheme includes: shifting the state of the communication device from thesecond state to a third state, the third state being a state in whichthe communication device is capable of responding to the authenticationrequest using only the target channel among the plurality of channelsand is capable of responding to the search signal using only the targetchannel among the plurality of channels.
 2. The communication device asin claim 1, wherein the target channel is one channel that is determinedin advance among the plurality of channels.
 3. The communication deviceas in claim 1, wherein the process for establishing the wirelessconnection according to the first scheme further includes: in a casewhere the second instruction is obtained while the state of thecommunication device is the first state: selecting one channel among theplurality of channels; and shifting the state of the communicationdevice from the first state to a fourth state, the fourth state being astate in which the communication device does not respond to theauthentication request and is capable of responding to the search signalusing only the selected one channel among the plurality of channels. 4.The communication device as in claim 3, wherein the one channel is achannel which is currently least used around the communication device.5. The communication device as in claim 1, wherein the first instructionis obtained by a power button of the communication device being operatedin a state in which power of the communication device is off, and thesecond instruction is obtained by a predetermined button of thecommunication device different from the power button being operatedafter the power of the communication device has been turned on.
 6. Thecommunication device as in claim 1, wherein the process for establishingthe wireless connection according to the first scheme further includes:sending an authentication response to a terminal device via the wirelessinterface in a case where the authentication request using the targetchannel and the public key is received from the terminal device via thewireless interface while the state of the communication device is thesecond state or the third state after the channel information and thepublic key have been obtained by the terminal device in response to theoutput-information having been externally outputted; and in a case wherethe authentication response is sent, establishing a first wirelessconnection between the communication device and a first external devicevia the wireless interface, wherein the process for establishing thewireless connection according to the second scheme further includes:sending a search response to a second external device via the wirelessinterface in a case where the search signal using the target channel isreceived from the second external device via the wireless interfacewhile the state of the communication device is the third state; and in acase where the search response is sent, establishing a second wirelessconnection between the communication device and the second externaldevice via the wireless interface.
 7. The communication device as inclaim 1, wherein the first scheme is a Device Provisioning Protocolscheme.
 8. The communication device as in claim 1, wherein the secondscheme is a Wi-Fi Direct scheme.
 9. The communication device as in claim1, wherein the output unit is a display unit, the output-information isa code image obtained by coding the channel information and the publickey, and the output control process is a process for displaying the codeimage on the display unit.
 10. A communication device comprising: awireless interface configured to execute wireless communicationaccording to Wi-Fi standard; an output unit; and a controller configuredto: execute a process for establishing a wireless connection between thecommunication device and another device via the wireless interfaceaccording to a first scheme of the Wi-Fi standard; and execute a processfor establishing a wireless connection between the communication deviceand another device via the wireless interface according to a secondscheme of the Wi-Fi standard, the second scheme being different from thefirst scheme, wherein in a case where a second instruction for enablingcommunication according to the second scheme is obtained while a stateof the communication device is a first state, the process forestablishing the wireless connection according to the second schemeincludes: shifting the state of the communication device from the firststate to a second state, the first state being a state in which thecommunication device does not respond to an authentication requestaccording to the first scheme and does not respond to a search signalaccording to the second scheme, the second state being a state in whichthe communication device does not respond to the authentication requestand is capable of responding to the search signal using only a firstchannel, the first channel being one of a plurality of channels whichthe wireless interface is capable of using, wherein in a case where afirst instruction for enabling a communication according to the firstscheme is obtained while the state of the communication device is thesecond state, the process for establishing the wireless connectionaccording to the first scheme includes: executing an output controlprocess for causing the output unit to externally outputoutput-information according to the first scheme, the output-informationbeing information obtained by using channel information indicating asecond channel different from the first channel among the plurality ofchannels and a public key of the communication device; and shifting thestate of the communication device from the second state to a thirdstate, the third state being a state in which the communication deviceis capable of responding to the authentication request using only thesecond channel among the plurality of channels and is capable ofresponding to the search signal using only the second channel among theplurality of channels.
 11. The communication device as in claim 10,wherein the process for establishing the wireless connection accordingto the second scheme further includes: in the case where the secondinstruction is obtained while the state of the communication device isthe first state, selecting the first channel from the plurality ofchannels, the second state being a state in which the communicationdevice does not respond to the authentication request and is capable ofresponding to the search signal using only the selected first channel.12. The communication device as in claim 11, wherein the first channelis a channel which is currently least used around the communicationdevice.
 13. The communication device as in claim 10, wherein the secondchannel is one channel that is determined in advance among the pluralityof channels.
 14. The communication device as in claim 10, wherein thesecond instruction is obtained by a power button of the communicationdevice being operated in a state in which power of the communicationdevice is off, and the first instruction is obtained by a predeterminedbutton of the communication device different from the power button beingoperated after the power of the communication device has been turned on.15. The communication device as in claim 10, wherein in a case where thefirst instruction is obtained while the state of the communicationdevice is the second state and the wireless connection between thecommunication device and another device according to the second schemeis not being established, the state of the communication device isshifted from the second state to the third state, and in a case wherethe first instruction is obtained while the state of the communicationdevice is the second state and the wireless connection between thecommunication device and another device according to the second schemeis being established, the state of the communication device ismaintained in the second state.
 16. The communication device as in claim10, wherein the process for establishing the wireless connectionaccording to the first scheme further includes: sending anauthentication response to a terminal device via the wireless interfacein a case where the channel information and the public key are obtainedby the terminal device in response to the output-information having beenexternally outputted and the authentication request using the secondchannel and the public key is received from the terminal device via thewireless interface while the state of the communication device is thethird state; and in a case where the authentication response is sent,establishing a first wireless connection between the communicationdevice and a first external device via the wireless interface, whereinthe process for establishing the wireless connection according to thesecond scheme further includes: sending a search response to a secondexternal device via the wireless interface in a case where the searchsignal using the first channel is received from the second externaldevice via the wireless interface while the state of the communicationdevice is the second state, or in a case where the search signal usingthe second channel is received from the second external device via thewireless interface while the state of the communication device is thethird state; and in a case where the search response is sent,establishing a second wireless connection between the communicationdevice and the second external device via the wireless interface. 17.The communication device as in claim 10, wherein the first scheme is aDevice Provisioning Protocol scheme.
 18. The communication device as inclaim 10, wherein the second scheme is a Wi-Fi Direct scheme.
 19. Thecommunication device as in claim 10, wherein the output unit is adisplay unit, the output-information is a code image obtained by codingthe channel information and the public key, and the output controlprocess is a process for displaying the code image on the display unit.20. A non-transitory computer-readable recording medium storing computerreadable instructions for a communication device, wherein thecommunication device comprises: a wireless interface configured toexecute wireless communication according to Wi-Fi standard; an outputunit; and a processor, the computer-readable instructions, when executedby the processor, cause the communication device to: execute a processfor establishing a wireless connection between the communication deviceand another device via the wireless interface according to a firstscheme of the Wi-Fi standard; and execute a process for establishing awireless connection between the communication device and another devicevia the wireless interface according to a second scheme of the Wi-Fistandard, the second scheme being different from the first scheme,wherein in a case where a first instruction for enabling communicationaccording to the first scheme is obtained while a state of thecommunication device is a first state, the process for establishing thewireless connection according to the first scheme includes: executing anoutput control process for causing the output unit to externally outputoutput-information according to the first scheme, the output-informationbeing information obtained by using channel information indicating atarget channel and a public key of the communication device, the targetchannel being one of a plurality of channels which the wirelessinterface is capable of using; and shifting the state of thecommunication device from the first state to a second state, the firststate being a state in which the communication device does not respondto an authentication request according to the first scheme and does notrespond to a search signal according to the second scheme, the secondstate being a state in which the communication device is capable ofresponding to the authentication request using only the target channelamong the plurality of channels and does not respond to the searchsignal, wherein in a case where a second instruction for enabling acommunication according to the second scheme is obtained while the stateof the communication device is the second state, the process forestablishing the wireless connection according to the second schemeincludes: shifting the state of the communication device from the secondstate to a third state, the third state being a state in which thecommunication device is capable of responding to the authenticationrequest using only the target channel among the plurality of channelsand is capable of responding to the search signal using only the targetchannel among the plurality of channels.
 21. A non-transitorycomputer-readable recording medium storing computer readableinstructions for a communication device, wherein the communicationdevice comprises: a wireless interface configured to execute wirelesscommunication according to Wi-Fi standard; an output unit; and aprocessor, the computer-readable instructions, when executed by theprocessor, cause the communication device to: execute a process forestablishing a wireless connection between the communication device andanother device via the wireless interface according to a first scheme ofthe Wi-Fi standard; and execute a process for establishing a wirelessconnection between the communication device and another device via thewireless interface according to a second scheme of the Wi-Fi standard,the second scheme being different from the first scheme, wherein in acase where a second instruction for enabling communication according tothe second scheme is obtained while a state of the communication deviceis a first state, the process for establishing the wireless connectionaccording to the second scheme includes: shifting the state of thecommunication device from the first state to a second state, the firststate being a state in which the communication device does not respondto an authentication request according to the first scheme and does notrespond to a search signal according to the second scheme, the secondstate being a state in which the communication device does not respondto the authentication request and is capable of responding to the searchsignal using only a first channel, the first channel being one of aplurality of channels which the wireless interface is capable of using,wherein in a case where a first instruction for enabling a communicationaccording to the first scheme is obtained while the state of thecommunication device is the second state, the process for establishingthe wireless connection according to the first scheme includes:executing an output control process for causing the output unit toexternally output output-information according to the first scheme, theoutput-information being information obtained by using channelinformation indicating a second channel different from the first channelamong the plurality of channels and a public key of the communicationdevice; and shifting the state of the communication device from thesecond state to a third state, the third state being a state in whichthe communication device is capable of responding to the authenticationrequest using only the second channel among the plurality of channelsand is capable of responding to the search signal using only the secondchannel among the plurality of channels.